<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"  xmlns:f="http://java.sun.com/jsf/core" xmlns:c="http://java.sun.com/jsp/jstl/core">
     <ui:composition template="/template.xhtml">
         <ui:define name="title">
             Столы ресторана
         </ui:define>
            <ui:define name="content">
                <h3> Столы ресторана</h3>
          
                <h:dataTable headerClass="table-header" rowClasses="table-row" value="#{TablesBean.allTables}" var="o">
                    <h:column>
                        <f:facet name="header">номер столика</f:facet>
                        #{o.id}
                    </h:column>
                    <h:column>
                        <f:facet name="header">количество мест за столиком</f:facet>
                        #{o.countSeats}
                    </h:column>
                    
                    <c:if test="#{TablesBean.curentTable != null}">
                        <h:column>
                            <f:facet name="header"></f:facet>
                            <h:graphicImage onclick="$('#UserSendMessage').arcticmodal()" value="/ors/faces/javax.faces.resource/img/mess_add24.png" />
                            
                               <div style="display: none;">
                                <div class="b-modal" id="UserSendMessage">
                                    <div class="b-modal_close arcticmodal-close">закрыть</div>    
                                    <h:form   id="UserMessage">
                                          Текст
                                                 
                                             <br/> <h:inputTextarea rows="5" cols="50" id="messageText" value="#{messageBean.text}" />
                                             
                                                             
                                        <p/><h:commandButton  id="sendMessage" value="Отправить" action="#{messageBean.sendMessage}" actionListener="#{messageBean.attrListener}">
                                            <f:attribute name="userTo" value="#{o}"/>
                                            <f:attribute name="userFrom" value="#{userBean.curentUser}" />
                                            </h:commandButton>
                                    </h:form>  
                                </div>
                            </div>
                        </h:column>
                    </c:if>
                </h:dataTable>
            </ui:define>
        </ui:composition>
</html>